<?php

class Task {

    private $mId;
    private $mName;
    private $mStartDate;
    private $mDueDate;
    private $mPriority;
    private $mStatusId;
    private $mProjectId;
    private $mNotes;
    private $mCreatedBy;
    private $mCreatedDate;
    private $mLastUpdatedBy;
    private $mLastUpdatedDate;
    private $mTaskAssignment;
    private $mIssue;

    public function getId() {
        return $this->mId;
    }

    public function setId($value) {
        $this->mId = $value;
    }

    public function getName() {
        return $this->mName;
    }

    public function setName($value) {
        $this->mName = $value;
    }

    public function getStartDate() {
        return $this->mStartDate;
    }

    public function setStartDate($value) {
        $this->mStartDate = $value;
    }

    public function getDueDate() {
        return $this->mDueDate;
    }

    public function setDueDate($value) {
        $this->mDueDate = $value;
    }

    public function getPriority() {
        if(($this->mPriority != null)&&(!$this->mPriority->IsLoaded())){
            $priorityDao = new PriorityDao();
            $this->mPriority = $priorityDao->getObject($this->mPriority->getId());
            if ($this->mPriority != null) $this->mPriority->setIsLoaded(true);
        }
        return $this->mPriority;
    }

    public function setPriority($value) {
        $this->mPriority = $value;
    }
	
    public function getStatus() {
        if(($this->mStatusId != null)&&(!$this->mStatusId->IsLoaded())){
            $statusDao = new StatusDao();
            $this->mStatusId = $statusDao->getObject($this->mStatusId->getId());
            if ($this->mStatusId != null) $this->mStatusId->setIsLoaded(true);
        }
        return $this->mStatusId;
    }

    public function setStatus($value) {
        $this->mStatusId = $value;
    }
	
    public function getProject() {
        if(($this->mProjectId != null)&&(!$this->mProjectId->IsLoaded())){
            $projectDao = new ProjectDao();
            $this->mProjectId = $projectDao->getObject($this->mProjectId->getId());
            if ($this->mProjectId != null) $this->mProjectId->setIsLoaded(true);
        }
        return $this->mProjectId;
    }

    public function setProject($value) {
        $this->mProjectId = $value;
    }
	
    public function getNotes() {
        return $this->mNotes;
    }

    public function setNotes($value) {
        $this->mNotes = $value;
    }
	
    public function getCreatedBy() {
        if(($this->mCreatedBy != null)&&(!$this->mCreatedBy->IsLoaded())){
            $UserDao = new UserDao();
            $this->mCreatedBy = $UserDao->getObject($this->mCreatedBy->getId());
            if ($this->mCreatedBy != null) $this->mCreatedBy->setIsLoaded(true);
        }
        return $this->mCreatedBy;
    }

    public function setCreatedBy($value) {
        $this->mCreatedBy = $value;
    }
    
    public function getCreatedDate() {
        return $this->mCreatedDate;
    }

    public function setCreatedDate($value) {
        $this->mCreatedDate = $value;
    }
	
    public function getLastUpdatedBy() {
        if(($this->mLastUpdatedBy != null)&&(!$this->mLastUpdatedBy->IsLoaded())){
            $userDao = new UserDao();
            $this->mLastUpdatedBy = $projectDao->getObject($this->mLastUpdatedBy->getId());
            if ($this->mLastUpdatedBy != null) $this->mLastUpdatedBy->setIsLoaded(true);
        }
        return $this->mLastUpdatedBy;
    }

    public function setLastUpdatedBy($value) {
        $this->mLastUpdatedBy = $value;
    }
	
    public function getLastUpdatedDate() {
        return $this->mLastUpdatedDate;
    }

    public function setLastUpdatedDate($value) {
        $this->mLastUpdatedDate = $value;
    }
	
    public function getTaskAssignment(){
        if (($this->mTaskAssignment == null)) {
            $TaskAssignmentDao = new TaskAssignmentDao();
            $this->mTaskAssignment = $TaskAssignmentDao->getListByTaskId($this->mId);
            }
        return $this->mTaskAssignment;
    }
	
    public function setTaskAssignment($value){
        $this->mTaskAssignment = $value;
    }
    
    public function getIssue(){
        if (($this->mIssue == null)) {
            $IssueDao = new IssueDao();
            $this->mIssue = $IssueDao->getListByTaskId($this->mId);
            }
        return $this->mIssue;
    }
    
    public function setIssue($value){
        $this->mIssue = $value;
    }
    
    public function IsLoaded() {
        return $this->mIsLoaded;
    }

    public function setIsLoaded($value) {
        $this->mIsLoaded = $value;
    }
    
}
